-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Packet diagram can use bit counts - implements #5978 #5980
base: develop
Are you sure you want to change the base?
Feature: Packet diagram can use bit counts - implements #5978 #5980
Conversation
|
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
commit: |
Tried to add a feature changeset but I get |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5980 +/- ##
==========================================
- Coverage 4.64% 4.64% -0.01%
==========================================
Files 374 374
Lines 51965 51985 +20
Branches 613 613
==========================================
Hits 2414 2414
- Misses 49551 49571 +20
Flags with carried forward coverage won't be shown. Click here to find out more.
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
@aloisklink please review this PR - I think it's ready |
What's the process to get this approved? |
(I just copied the following to the #5978, in case that's a better location for syntax discussions.) I was considering using the "packet" type as a way to draw a memory map, which would be byte-scale instead of bit-scale. I wonder if a different syntax that didn't "tie" the diagram to a particular unit of measure would be more flexible? Shorting to
Using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work @BryanCrotazGivEnergy, love the implementation and tests!
@zanedp makes a really good point, and I feel the + syntax looks better, and is easier to write & read. It'll also make the parser a bit simpler.
Do you mind modifying the syntax to the + based one? Thank you!
Current
packet-beta
title UDP Packet
0-15: "Source Port"
16-31: "Destination Port"
32-47: "Length"
48-63: "Checksum"
64-95: "Data (variable length)"
bit(s) syntax
packet-beta
title UDP Packet
16bits: "Source Port"
16bits: "Destination Port"
16bits: "Length"
16bits: "Checksum"
32bits: "Data (variable length)"
bit(s) syntax (mixed)
packet-beta
title UDP Packet
0-15: "Source Port"
16bits: "Destination Port"
32-47: "Length"
16bits: "Checksum"
32bits: "Data (variable length)"
+ syntax
packet-beta
title UDP Packet
+16: "Source Port"
+16: "Destination Port"
+16: "Length"
+16: "Checksum"
+32: "Data (variable length)"
+ syntax (mixed)
packet-beta
title UDP Packet
0-15: "Source Port"
+16: "Destination Port"
32-47: "Length"
+16: "Checksum"
+32: "Data (variable length)"
--- | ||
Using start and end bit counts can be difficult, especially when modifying a design. For this we add a bit count field, which starts from the end of the previous field automagically. Use `bit` or `bits` interchangeably to set the number of bits, thus: | ||
|
||
````md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this means the example will not be rendered. Please use mermaid-example
directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I don't understand - adding what?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrapping with ````md
📑 Summary
Resolves #5978
📏 Design Decisions
Added bit count to parser language and calculate start and end of each field on the fly
📋 Tasks
Make sure you
MERMAID_RELEASE_VERSION
is used for all new features.pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.